<template>
	<view class="productbusiness" :style="{minHeight: wHeight + 'px' }">
		<view class="productbusiness-top">
			<view class="productbusiness-img">
				<image src="../../static/image/banner.png" mode=""></image>
			</view>
		</view>
		<view class="productbusiness-tab">
			<view class="tab_nav">
				<view class="navTitle" v-for="(item,index) in navList" :key="index">
					<image src="/static/image/icon-zhuang.png" mode=""></image>
					<view :class="{'active':isActive === index}" @click="checked(index)">
						{{item.title}}
					</view>
				</view>
			</view>
			<view class="introduce" v-if="isActive==0">
				<view class="introduce-t">
					<text>商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍商家介绍</text>
				</view>
			</view>
			<view class="introduce-ul" v-if="isActive==1">
				<view class="introduce-li">
					<view class="introduce-li-img">
						<image src="/static/image/11.jpg" mode=""></image>
					</view>
					<view class="introduce-wen">
						<text>产品名称</text>
					</view>
				</view>
				<view class="introduce-li">
					<view class="introduce-li-img">
						<image src="/static/image/11.jpg" mode=""></image>
					</view>
					<view class="introduce-wen">
						<text>产品名称</text>
					</view>
				</view>
				<view class="introduce-li">
					<view class="introduce-li-img">
						<image src="/static/image/11.jpg" mode=""></image>
					</view>
					<view class="introduce-wen">
						<text>产品名称</text>
					</view>
				</view>
			</view>
		</view>
		<!-- 留言功能 -->
		<commentlist :comment='comment' @removedata='removeComment'></commentlist>

		<!-- 弹框 -->
		<view class="mask" v-if="more">
			<view class="mask-layer-black" :style="{minHeight: wHeight + 'px' }" @click="colse"></view>
			<view class="mask-lo">
				<!-- <textarea class="input idea-m" placeholder="留言给商家" rows="1" ref="address"></textarea>
				<view class="mask-li">
					<button>发送</button>
				</view> -->
				<commentinput v-on:sendtoparent='getComment'></commentinput>
			</view>
		</view>
		<view class="productbusiness-bottom">
			<view class="introduce-ly" @click="message">
				<text>留言</text>
			</view>
			<view class="introduce-ly">
				<text>联系我们</text>
			</view>
		</view>
	</view>
</template>

<script>
	import commentinput from '../../components/Message-board/commentinput.vue'
	import commentlist from '../../components/Message-board/commentlist.vue'
	export default {
		data() {
			return {
				more: false,
				wHeight: '',
				isActive: 0,
				navList: [{
					index: 0,
					title: '商家介绍'
				}, {
					index: 1,
					title: "商家产品"
				}, ],
				comment: [{
					userimage: 'index1',
					username: '小雨淅淅',
					comment: '留言留言',
					createTime: 'Tue Feb 18 2020 12:12:12 GMT+0800 (中国标准时间)'
				},
				]
			};
		},
		onLoad() {
			this.wHeight = this.$store.state.ContentHeight - 45;
		},
		methods: {
			checked(index) {
				this.isActive = index
			},
			//弹出
			message() {
				this.more = true;
			},
			// 点击空白处
			colse() {
				this.more = false;
			},
			// 发送评论
			getComment(data) {
				console.log(2);
				this.comment.push(data)
			},
			// 删除评论
			removeComment(index) {
				this.comment.splice(index, 1)
			}

		},
		components: {
			commentinput,
			commentlist
		}
	}
</script>

<style lang="less" scoped>
	.productbusiness {
		position: relative;

		.productbusiness-top {
			display: flex;
			justify-content: center;

			.productbusiness-img {
				image {
					width: 686rpx;
					height: 256rpx;
				}
			}
		}

		.productbusiness-tab {
			position: relative;

			.tab_nav {
				width: 750rpx;
				display: flex;
				justify-content: space-around;
				align-items: center;

				.navTitle {
					height: 90rpx;
					line-height: 90rpx;
					width: 750;
					text-align: center;
					font-size: 37rpx;
					font-family: Source Han Sans CN;
					font-weight: 400;
					color: #666666;

					image {
						position: absolute;
						width: 28rpx;
						height: 28rpx;
						margin-top: 40rpx;
						margin-left: -85rpx;
					}

					.active {
						position: relative;
						font-size: 37rpx;
						font-family: Source Han Sans CN;
						font-weight: bold;
						color: #000000;
					}
				}
			}

			.active::after {
				content: "";
				position: absolute;
				width: 100rpx;
				height: 8rpx;
				left: 0px;
				right: 0px;
				bottom: 0px;
				margin: auto;
			}

			.introduce {
				.introduce-t {
					margin: 0 auto;
					width: 670rpx;
					font-size: 32rpx;
					font-family: Source Han Sans CN;
					font-weight: 400;
					color: #666666;
					line-height: 48rpx;
				}
			}

			.introduce-ul {
				width: 700rpx;
				margin: 0 auto;
				display: flex;
				justify-content: space-between;
				flex-wrap: wrap;

				.introduce-li {
					width: 328rpx;
					text-align: center;
					margin-top: 30rpx;

					.introduce-li-img {
						image {
							width: 328rpx;
							height: 328rpx;
						}
					}

					.introduce-wen {
						display: flex;
						flex-direction: column;

						text {
							font-size: 32rpx;
							font-family: Source Han Sans CN;
							font-weight: bold;
							color: #333333;
						}
					}
				}
			}
		}

		.productbusiness-bottom {
			width: 750rpx;
			display: flex;
			justify-content: space-around;
			margin-top: 20rpx;

			.introduce-ly {
				width: 330rpx;
				height: 98rpx;
				background: #0099FF;
				border-radius: 13rpx;
				text-align: center;
				line-height: 98rpx;

				text {
					font-size: 32rpx;
					font-family: Source Han Sans CN;
					font-weight: bold;
					color: #FFFFFF;
				}
			}
		}

		.mask {
			width: 262rpx;
			height: 496rpx;
			position: absolute;
			bottom: 0rpx;

			.mask-layer-black {
				width: 100%;
				height: auto;
				background: rgba(0, 0, 0, .3);
				position: fixed;
				top: 0;
				left: 0;
				bottom: 0;
				z-index: 1;
			}

			.mask-lo {
				background-color: #FFFFFF;
				width: 750rpx;
				height: 232rpx;
				position: fixed;
				bottom: 0;
				z-index: 2;

				textarea {
					margin: 10rpx 20rpx;
					height: 100rpx;
					font-size: 27rpx;
					font-family: Source Han Sans CN;
					font-weight: 400;
					color: #999999;
				}

				.mask-li {
					width: 95rpx;
					height: 44rpx;
					background: #E2E2E2;
					text-align: center;
					line-height: 40rpx;
					position: absolute;
					right: 30rpx;

					button {
						font-size: 27rpx;
						font-family: Source Han Sans CN;
						font-weight: 400;
						color: #999999;
					}
				}

			}
		}
	}
</style>
